/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __USART_H
#define __USART_H

/* Includes ------------------------------------------------------------------*/
#include "main.h"

/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
  
#define USART_BAUDRATE          38400
#define usart1tx_buf_len 128

/* Private defines -----------------------------------------------------------*/
  /* USART Communication boards Interface */
#define USARTx                           USART1
#define USARTx_CLK                       RCC_APB2Periph_USART1
#define USARTx_APBPERIPHCLOCK            RCC_APB2PeriphClockCmd
#define USARTx_IRQn                      USART1_IRQn
#define USARTx_IRQHandler                USART1_IRQHandler

#define USARTx_TX_PIN                    GPIO_Pin_9
#define USARTx_TX_GPIO_PORT              GPIOA
#define USARTx_TX_GPIO_CLK               RCC_AHBPeriph_GPIOA
#define USARTx_TX_SOURCE                 GPIO_PinSource9
#define USARTx_TX_AF                     GPIO_AF_7

#define USARTx_RX_PIN                    GPIO_Pin_10
#define USARTx_RX_GPIO_PORT              GPIOA
#define USARTx_RX_GPIO_CLK               RCC_AHBPeriph_GPIOA
#define USARTx_RX_SOURCE                 GPIO_PinSource10
#define USARTx_RX_AF                     GPIO_AF_7

#define USARTx_DIR_PIN                   GPIO_Pin_12
#define USARTx_DIR_GPIO_PORT             GPIOA
#define USARTx_DIR_GPIO_CLK              RCC_AHBPeriph_GPIOA
#define USARTx_DIR_SOURCE                GPIO_PinSource12
#define USARTx_DIR_AF                    GPIO_AF_7

//#define TXBUFFERSIZE                     (countof(TxBuffer) - 1)
//#define RXBUFFERSIZE                     TXBUFFERSIZE

/* Exported functions ------------------------------------------------------- */
void USART_Config(void);
void USART_Handler(void);
int8_t USART_sendarray(uint8_t* arr, uint8_t n);
#endif /* __USART_H */
